package com.googlecode.maratische.google.listeners;

import java.util.ArrayList;
import java.util.List;

import com.googlecode.maratische.google.model.Feed;

public class SelectItemObservable {

	private List<SelectItemListener> listeners = new ArrayList<SelectItemListener>();
	
	public void updateItemStringForCurrentItem() {
		for (SelectItemListener listener : listeners) {
			listener.updateItemStringForCurrentItem();
		}
	}
	
	public void addObserver(SelectItemListener listener) {
		listeners.add(listener);
	}
	
	public void selectLeft() {
		for (SelectItemListener listener : listeners) {
			listener.selectLeft();
		}
	}
	
	public void selectRight() {
		for (SelectItemListener listener : listeners) {
			listener.selectRight();
		}
	}
	
	public boolean canLeft() {
		for (SelectItemListener listener : listeners) {
			return listener.canLeft();
		}
		return false;
	}
	
	public boolean canRight() {
		for (SelectItemListener listener : listeners) {
			return listener.canRight();
		}
		return false;
	}
	
	public void showInfWindowAddOfflineMode(final Feed selectedFeed) {
		for (SelectItemListener listener : listeners) {
			listener.showInfWindowAddOfflineMode(selectedFeed);
		}
	}
	
	public void showInfWindowCheckNewFeeds(final List<Feed> newFeeds) {
		for (SelectItemListener listener : listeners) {
			listener.showInfWindowCheckNewFeeds(newFeeds);
		}
	}
	
	public void showWindowTreeAddNewFeeds() {
		for (SelectItemListener listener : listeners) {
			listener.showWindowTreeAddNewFeeds();
		}
	}
	
	public void disableInfWindow() {
		for (SelectItemListener listener : listeners) {
			listener.disableInfWindow();
		}
	}
}
